home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2004 #6 / Amiga Plus CD - 2004 - No. 06.iso / AmigaPlus / Begleitmaterial / 50Tools / Grafik / PerfectPaint / rexx / general / SaveGif_Picture.rx < prev    next >
Text File  |  2002-10-15  |  2KB  |  140 lines

  1. /*  arexx Script 
  2.   SAVE Picture in GIF format
  3.   need 'tapgif' in PerfectPaint:tools/  
  4. */
  5.  
  6.   options results
  7.   parse ARG Port b
  8.   ADDRESS value Port
  9.   pp_AvoidRefresh
  10.  
  11.   file=""
  12.   file2=""
  13.   option=0
  14.   if EXISTS('PerfectPaint:Prefs/Rexx_Prefs/SaveGif_Picture') THEN DO
  15.     IF OPEN('lfile','PerfectPaint:Prefs/Rexx_Prefs/SaveGif_Picture', "R") then DO
  16.       file = READLN('lfile')
  17.       option=READLN('lfile')
  18.       CALL CLOSE('lfile')
  19.       file2=""
  20.       do i=1 to LENGTH(file)
  21.         a=SUBSTR(file,i,1)
  22.         if a=" " then DO
  23.           a="*"
  24.         END
  25.         file2=file2||a
  26.       END
  27.       file=file2
  28.     END
  29.   END
  30.  
  31.   pp_showscreen
  32.  
  33.     pp_GetWidth
  34.     W=result
  35.     pp_GetHeight
  36.     H=result
  37.     Info=W||"x"||H||"x8"
  38.  
  39.   pp_GetDepth
  40.   D=result
  41.   IF D=24 then DO
  42.     pp_RenderReq 0
  43.   END
  44.  
  45.   pp_DialogInit 250 90 "*Save*Gif*Picture*" 3
  46.     pp_String 0 50 12 150 16 "Name" 1 100 file
  47.  
  48.     n=LASTPOS('/',file)
  49.     if n=0 then DO
  50.       n=LASTPOS(':',file)
  51.       file=SUBSTR(file,1,n)
  52.     END
  53.     else DO     
  54.       file=SUBSTR(file,1,n)
  55.     END
  56.  
  57.     pp_Getfile 1 205 13 0 "Save*Gif" 0 file
  58.     pp_Cycle 2 100 32 100 16 "Transparency" 1 "No|Color*0|Current*Bg" option
  59.   pp_Dialog 
  60.  
  61.   rc=result
  62.   if rc=0 then
  63.     do
  64.       pp_PermitRefresh
  65.       EXIT
  66.     end 
  67.  
  68.   pp_GetDialog 0
  69.   file=result
  70.  
  71.   pp_GetDialog 2
  72.   option=result
  73.  
  74.   CALL SavePrefs('SaveGif_Picture',file,option)
  75.   ADDRESS value Port
  76.  
  77.   if option=2 then
  78.   DO
  79.     pp_GetBpen
  80.     Bpen=result
  81.   END
  82.  
  83.   if option=1 then
  84.   DO
  85.     Bpen=0
  86.   END
  87.  
  88.   IF D=24 then DO
  89.     pp_Render 0 'T:pptemp'
  90.   END
  91.  
  92.   IF D<24 THEN DO
  93.     pp_save 'T:pptemp' 0
  94.   END
  95.  
  96.   pp_asay 'Making*GIF*file|Please*wait*...'     
  97.   address COMMAND
  98.   if option=0 then
  99.   DO
  100.     'perfectpaint:tools/tapgif '||'T:pptemp '||'"'||file||'"'
  101.   END
  102.   ELSE
  103.   DO
  104.     'perfectpaint:tools/tapgif '||'T:pptemp '||'"'||file||'"'||' TRAN '||Bpen
  105.   END
  106.  
  107.   'delete >nil: T:pptemp'
  108.  
  109.   ADDRESS value Port
  110.  
  111.     pp_SaveIconFor file 0
  112.   pp_closeasay
  113.     pp_AddItemHistory file Info
  114.  
  115.   pp_PermitRefresh
  116.   EXIT
  117.   
  118.  
  119.  
  120. SavePrefs: PROCEDURE
  121.   
  122.   Prefname='PerfectPaint:Prefs/Rexx_Prefs/'||ARG(1)
  123.  
  124.   if EXISTS(Prefname) THEN DO
  125.     ADDRESS COMMAND
  126.     'delete >nil: '||Prefname
  127.   END
  128.  
  129.   IF OPEN('pfile',PrefName,'W') THEN DO
  130.  
  131.   do i=2 to ARG()
  132.     CALL WRITELN('pfile',ARG(i))
  133.   end
  134.  
  135.   CALL CLOSE('pfile')
  136.  
  137. RETURN  
  138.  
  139.  
  140.